package com.qf.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qf.dto.ProductDTO;
import com.qf.service.ProductService;
import com.qf.service.UserService;
import com.qf.vo.ResultVO;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/product")
@CrossOrigin(allowCredentials = "true")
public class ProductController {
    @Reference
    private ProductService productService;


    @GetMapping("/list")
    public ResultVO list(){
        //1. 调用service查询全部商品信息.
        List<ProductDTO> productDTOList = productService.findAll();
        //2. 响应数据
        return new ResultVO(0,"成功",productDTOList);
    }

}
